<?php

namespace IDock\Insurance\ZYIC\Request;

use IDock\Insurance\ZYIC\Response\PolicyPaymentResponse;
use IDock\Insurance\ZYIC\ZYICEnums;
use IDock\Insurance\ZYIC\Request\AllZYICRequest;
use IDock\Insurance\ZYIC\Response\SaveOrderResponse;
use IDock\Visitor\PolicyPaymentVisitor;
use IDock\Visitor\Premium\PremiumInquiryVisitor;
use IDock\Visitor\VehicleActualValueVisitor;

class PolicyPaymentRequest extends AllZYICRequest
{
    public $route = 'channelInterface/V07';

    protected $response = PolicyPaymentResponse::class;

    protected $urlTip = '支付';

    /*** @var  PolicyPaymentVisitor $visitor */
    protected $visitor;

    public $channelCode = '';

    public function generate(): array
    {
        $arr = [
            'proposalNo' => $this->visitor->biInquiryNo,
            'proposalNoCI' => $this->visitor->ciInquiryNo,
            'appliMobile' => $this->visitor->argc['applicantMobile'] ?? '',
            'isSendMessage' => '0',
            'channelCode' => ($this->visitor->argc['nonCarChannelCode'] ?? '') ?: $this->channelCode,
            'channelOrderNo' => $this->visitor->argc['channelOrderNo'] ?? ''
        ];
        if(!empty($this->visitor->ciInquiryNo) && empty($this->visitor->biInquiryNo)){
            $arr['proposalNo'] = $this->visitor->ciInquiryNo;
            $arr['proposalNoCI'] = '';
        }
        return $arr;
    }

}
